# -*- coding: iso-8859-1 -*-
"""
@newfield project: Project 
@project: yatter
@newfield description: Description 
@description: Twitter Client, based on Python 2.5

@Author: U{Andreas del Galdo<mailto:andreas.delgaldo@mac.com>}
@summary: Representing a Tweet itself containing all the information.
          An instance of this Module for each Tweet is created on runtime.
"""

import logging

class tweet:

    def setTweet(self,created_at, id, text, source, trucated, in_reply_to_status_id, in_reply_to_user_id, favorited):
        try:
            logging.debug("twitter_api.tweet.setTweet()")
            self.__tweet_created_at            = created_at
            self.__tweet_id                    = id
            self.__tweet_text                  = text
            self.__tweet_source                = source
            self.__tweet_trucated              = trucated
            self.__tweet_in_reply_to_status_id = in_reply_to_status_id
            self.__tweet_in_reply_to_user_id   = in_reply_to_user_id
            self.__tweet_favorited             = favorited 
            return True
        except:
            logging.error("twitter_api.tweet.setTweet()::ERROR")
            return False
        
        
    def setUser(self,id, name, screen_name, description, location, profile_image_url, url, protected, followers_count):
        try:
            logging.debug("twitter_api.tweet.setUser()")
            self.__user_id                     = id
            self.__user_name                   = name
            self.__user_screen_name            = screen_name
            self.__user_description            = description
            self.__user_location               = location
            self.__user_profile_image_url      = profile_image_url
            self.__user_url                    = url
            self.__user_protected              = protected
            self.__user_followers_count        = followers_count
            return True
        except:
            logging.error("twitter_api.tweet.setUser()::ERROR")
            return False
    
    
    def getTweet(self):
        try:
            logging.debug("twitter_api.tweet.getTweet()")
            tweet = {'created_at' : self.__tweet_created_at, 'id' : self.__tweet_id, 'text' : self.__tweet_text, 'source' : self.__tweet_source, 
                     'trucated' : self.__tweet_trucated, 'in_reply_to_status_id' : self.__tweet_in_reply_to_status_id, 
                     'in_reply_to_user_id' : self.__tweet_in_reply_to_user_id,  'favorited' : self.__tweet_favorited}
            return tweet
        except:
            logging.error("twitter_api.tweet.getTweet()::ERROR")
            return False
    
    def getUser(self):
        try:
            logging.debug("twitter_api.tweet.getUser()")
            user = {'id' : self.__user_id, 'name' : self.__user_name, 'screen_name' : self.__user_screen_name, 
                    'description' : self.__user_description, 'location' : self.__user_location, 'profile_image_url' : self.__user_profile_image_url,
                    'url' : self.__user_url, 'protected' : self.__user_protected, 'followers_count' : self.__user_followers_count}
            return user
        except:
            logging.error("twitter_api.tweet.getUser()::ERROR")
            return False
        
        
    def __init__(self):
        pass
        
